package com.lancoo.answer.view.adapter

import android.view.View
import com.chad.library.adapter.base.entity.node.BaseNode
import com.chad.library.adapter.base.provider.BaseNodeProvider
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.lancoo.answer.R
import com.lancoo.answer.databinding.EvItemSentenceTitleBinding
import com.lancoo.answer.model.bean.Sentence

/**
 * Created by wealive on 2022/7/21.
 *
 *
 */
class SentenceListProvider : BaseNodeProvider() {
    override val itemViewType: Int
        get() = 0
    override val layoutId: Int
        get() = R.layout.ev_item_sentence_title

    override fun convert(helper: BaseViewHolder, item: BaseNode) {
        val binding = EvItemSentenceTitleBinding.bind(helper.itemView)
        val sentence = item as Sentence
        binding.tvSentence.text = "${sentence.Index + 1}.${sentence.SntOri}"
//        if (sentence.isExpanded) {
//            binding.vLine.visibility = View.VISIBLE
//            binding.ivArrow.setImageResource(R.mipmap.ev_icon_arrow_black_up)
//        } else {
//            binding.vLine.visibility = View.GONE
//            binding.ivArrow.setImageResource(R.mipmap.ev_icon_arrow_black_down)
//        }
    }

    override fun onClick(helper: BaseViewHolder, view: View, data: BaseNode, position: Int) {
        val sentence = data as Sentence
//        if (sentence.isExpanded) {
//            getAdapter()?.collapse(helper.layoutPosition)
//        } else {
//            getAdapter()?.expand(helper.layoutPosition)
//        }
    }
}